# _*_ coding: utf-8 _*_
from odoo import models, fields, api


class PurchaseRequisition(models.Model):
    _inherit = "purchase.requisition"

    def action_confirm_all_draft_lines(self):
        for req in self:
            draft_lines = req.line_ids.filtered(lambda l:l.state=="draft")
            if draft_lines:
                draft_lines.action_confirm()

    def action_cancel_all_draft_lines(self):
        for req in self:
            draft_lines = req.line_ids.filtered(lambda l: l.state == "draft")
            if draft_lines:
                draft_lines.action_cancel()
